@extends('template.vo')
@section('content')
<?php
if (Session::get('list') == "") {
    $list = 'idcard';
} else {
    $list = Session::get('list');
}

if ($list == 'idcard') {
    $ordername = 'ID Card';
} else if ($list == 'packaging') {
    $ordername = 'Packaging';
} else if ($list == 'brochure') {
    $ordername = 'Brosur';
} else if ($list == 'nota') {
    $ordername = 'Nota';
} else if ($list == 'tshirt') {
    $ordername = 'T-Shirt';
}
?>
<ol class="breadcrumb">
    <li class="active">Daftar harga</li>
</ol>

<div class="container-black" style="background-color: #fff;">
    <label style="margin-top:10px"><u>Download daftar harga</u></label>
    <div class="container-black-soft" style="background-color: #F0F0F0;">
        <br>
        <a href="{{URL::to('print/packagingprice')}}" target="_blank"><button class="btn btn-canceled" style="margin-bottom:10px; width:150px; height:30px">

                <label><i class="fa fa-download"></i> Packaging</label>

            </button></a>

        <a href="{{URL::to('print/idcardprice')}}" target="_blank"><button class="btn btn-incoming" style="margin-bottom:10px; width:150px; height:30px">

                <label><i class="fa fa-download"></i> ID Card</label>

            </button></a>

        <a href="{{URL::to('print/tshirtprice')}}" target="_blank"><button class="btn btn-summarysalesordertotal" style="margin-bottom:10px; width:150px; height:30px">

                <label><i class="fa fa-download"></i> Kaos</label>

            </button></a>

        <a href="{{URL::to('print/brochureprice')}}" target="_blank"><button class="btn btn-sumarryagenkemarin" style="margin-bottom:10px; width:150px; height:30px">

                <label><i class="fa fa-download"></i> Brosur</label>
            </button></a>

        <a href="{{URL::to('print/notaprice')}}" target="_blank"><button class="btn btn-delivered" style="margin-bottom:10px; width:150px; height:30px">

                <label><i class="fa fa-download"></i> Nota</label>

            </button></a>



    </div>
    <label style="margin-top:10px"><u>Pencarian</u></label>
    <div class="container-black-soft" style="background-color: #F0F0F0;">
        <br>
        <form action="{{URL::to('/virtualoffice/daftarhargaproduk')}}" method="POST">


            <div class="row">
                <div class="col-md-8">
                    <div class="col-md-1">
                        <input name="filter" value="type" type="radio" <?php if(Session::get('filter')=="type") echo "checked"; if(Session::get('filter')=="") echo "checked";  ?> ></input>
                    </div>
                    <div class="col-lg-3">
                        <label>Jenis produk</label>
                    </div>
                    <div class="col-lg-3">
                        <select  class="form-control" name="typeby" style="height:30px" />
                        <?php
                        $type = array('idcard' => 'ID Card', 'packaging' => 'Packaging', 'brochure' => 'Brosur', 'tshirt' => 'Kaos', 'nota' => 'Nota');
                        foreach ($type as $key => $val) {
                            if ($key == $list) {
                                echo '<option value="' . $key . '" selected>' . $val . '</option>';
                            } else {
                                echo '<option value="' . $key . '">' . $val . '</option>';
                            }
                        }
                        ?>
                        </select>
                    </div>
                </div>
            </div>
            <br>


            <div class="row">
                <div class="col-md-8">
                    <div class="col-md-1">
                        <input name="filter" value="keyword" type="radio"  <?php if(Session::get('filter')=="keyword") echo "checked" ?>></input>
                    </div>
                    <div class="col-lg-3">
                        <label>Kata kunci</label>
                    </div>
                    <div class="col-lg-3">
                        <input type="text"  class="form-control" placeholder="Kata kunci" name="keyword" style="height:30px" value="{{Session::get('keyword')}}" /></input>
                    </div>
                    <div class="col-lg-3 col-md-offset-1">
                        <select name="filterby" class="form-control" style="height:30px">
                         <?php
                            $type = array('harga' => 'Harga produk', 'name' => 'Nama produk');
                            foreach ($type as $key => $val) {
                                if ($key == Session::get('filterby')) {
                                    echo '<option value="' . $key . '" selected>' . $val . '</option>';
                                } else {
                                    echo '<option value="' . $key . '">' . $val . '</option>';
                                }
                            }
                            ?>
                        </select>
                    </div>
                </div>
            </div>
            <br>
            <div class="row">
                <div class="col-md-8">
                    <div class="col-md-4 col-md-offset-4">
                        <button class="btn btn-sm btn-dark" type="submit" style="height:30px"><span class="fa fa-search"></span> Tampilkan</button>
                    </div>
                </div>
            </div>
            <br>

        </form>
    </div>
    <label style="margin-top:10px"><u>Daftar harga</u></label>
    <br>
    <div class="table-responsive">
        <table class="table table-bordered table-hover">
            <thead>
                <tr>
                    <th>No</th>
                    <th>Jenis produk</th>
                    <th>Nama produk</th>
                    <th>Detail</th>
                    <th>Harga / Qty (Unit)</th>
                </tr>
            </thead>
            <tbody>
                <?php
                $limit = 10;
                if (Input::get('page') == 0 OR Input::get('page') == 1) {
                    $no = 1;
                } else {
                    $no = ((Input::get('page') - 1) * $limit) + 1;
                }
                ?>
                @if($list=='idcard')
                @foreach($pricelist as $pl)
            <td>{{$no}}</td>
            <td>{{$ordername}}</td>
            <td>{{$pl->idcard_quality_name}}</td>
            <td> - </td>
            <td>{{$pl->idcard_quality_price.' / '.$pl->idcard_quality_qty.' '.$pl->idcard_quality_unit}}</td>
            </tbody>
            <?php $no++; ?>
            @endforeach

            @elseif($list=='brochure')
            @foreach($pricelist as $pl)
            <td>{{$no}}</td>
            @if($pl->brochure_type=='brochure')
            <?php
            $brosr = DB::table('ref_brochure')
                    ->join('ref_papertype', 'papertype_id', '=', 'brochure_papertype_id')
                    ->join('ref_size_brochure', 'size_brochure_size_id', '=', 'brochure_size_id')
                    ->where('brochure_id', $pl->brochure_id)
                    ->first();
            ?>
            <td>{{$ordername}}</td>
            <td>{{$pl->brochure_type}}</td>
            <td>{{$brosr->brochure_color.', '.$brosr->size_brochure_name.', '.$brosr->papertype_name}}</td>
            @elseif($pl->brochure_type=='envelope')
            <?php
            $brosr = DB::table('ref_brochure')
                    ->join('ref_papertype', 'papertype_id', '=', 'brochure_papertype_id')
                    ->join('ref_size_envelope', 'size_envelope_size_id', '=', 'brochure_size_id')
                    ->where('brochure_id', $pl->brochure_id)
                    ->first();
            ?>
            <td>{{$ordername}} (Envelope)</td>
            <td>{{$pl->brochure_type}}</td>
            <td>{{$brosr->brochure_color.', '.$brosr->size_envelope_length.'x'.$brosr->size_envelope_width.'x '.$brosr->size_envelope_unit.' , '.$brosr->papertype_name}}</td>
            @elseif($pl->brochure_type=='flayer')
            <?php
            $brosr = DB::table('ref_brochure')
                    ->join('ref_papertype', 'papertype_id', '=', 'brochure_papertype_id')
                    ->join('ref_size_flayer', 'size_flayer_size_id', '=', 'brochure_size_id')
                    ->where('brochure_id', $pl->brochure_id)
                    ->first();
            ?>
            <td>{{$ordername}} (Flayer)</td>
            <td>{{$pl->brochure_type}}</td>
            <td>{{$brosr->brochure_color.', '.$brosr->size_flayer_length.'x'.$brosr->size_flayer_width.''.strtolower($brosr->size_flayer_unit).' , '.$brosr->papertype_name}}</td>
            @elseif($pl->brochure_type=='letterhead')
            <?php
            $brosr = DB::table('ref_brochure')
                    ->join('ref_papertype', 'papertype_id', '=', 'brochure_papertype_id')
                    ->join('ref_size_letterhead', 'size_letterhead_size_id', '=', 'brochure_size_id')
                    ->where('brochure_id', $pl->brochure_id)
                    ->first();
            ?>
            <td>{{$ordername}} (Letterhead)</td>
            <td>{{$pl->brochure_type}}</td>
            <td>{{$brosr->brochure_color.', '.$brosr->size_letterhead_name.', '.$brosr->papertype_name}}</td>
            @endif
            <td>{{$pl->brochure_price.' / '.$pl->brochure_qty_price.' '.$pl->brochure_unit}}</td>
            </tbody>
            <?php $no++; ?>
            @endforeach
            @elseif($list=='packaging')
            @foreach($pricelist as $pl)
            <td>{{$no}}</td>
            <td>{{$ordername}}</td>
            <td>{{$pl->packaging_type}}</td>
            <td>{{$pl->papertype_name.' '.$pl->packaging_length.'x'.$pl->packaging_width.'x'.$pl->packaging_height}}</td>
            <td>{{$pl->packaging_price.' / '.$pl->packaging_qty_price.' '.$pl->packaging_qty_unit}}</td>
            </tbody>
            <?php $no++; ?>
            @endforeach
            @elseif($list=='nota')
            @foreach($pricelist as $pl)
            <td>{{$no}}</td>
            <td>{{$ordername}}</td>
            <td>{{$pl->bill_name}}</td>
            <td> - </td>
            <td>{{$pl->bill_price.' / '.$pl->bill_qty_price.' '.$pl->bill_qty_unit}}</td>
            </tbody>
            <?php $no++; ?>
            @endforeach
            @elseif($list=='tshirt')
            @foreach($pricelist as $pl)
            <td>{{$no}}</td>
            <td>{{$ordername}}</td>
            <td>{{$pl->tshirt_type_of_material}}</td>
            <td> - </td>
            <td>{{$pl->tshirt_detail_price.' / '.$pl->tshirt_detail_qty_price.' '.$pl->tshirt_detail_qty_unit}}</td>
            </tbody>
            <?php $no++; ?>
            @endforeach
            @endif
        </table>
        <div class="text-right"><?php echo $pricelist->links(); ?></div>
    </div>
    <br>

    <br>
</div>

@stop
@stop